﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>龙啸轩管理后台</title>
    <link rel="stylesheet" href="~/lib/layui/css/layui.css">
    <link rel="stylesheet" href="~/admin/css/main.css">

</head>
<body>
    <div class="layui-layout layui-layout-admin">
        <!-- 头部导航 -->
        <div class="layui-header">
            <a href="javascript:;" onclick="loadMenu('/Admin/Menu/Index')"><div class="layui-logo layui-hide-xs cxuu-logo">CXUUCMS V5</div></a>
            <ul class="layui-nav layui-layout-left">
                <li title="左侧菜单显隐" id="leftMenuCtrl" class="layui-nav-item  cxuu_leftmenuctrl"><i class="layui-icon" aria-hidden="true"></i></li>
                @if (CheckExt.AuthView(ViewBag.sr, "menu_content"))
                {
                    <li class="layui-nav-item" title="文章内容管理"><a href="javascript:;" onclick="loadMenu('/Admin/Menu/Content')"><i class="layui-icon layui-icon-list" style="font-size: 22px;"></i></a></li>
                }
                @if (CheckExt.AuthView(ViewBag.sr, "menu_system"))
                {
                    <li class="layui-nav-item" title="系统设置与管理"><a href="javascript:;" onclick="loadMenu('/Admin/Menu/System')"><i class="layui-icon layui-icon-set-fill" style="font-size: 22px;"></i></a></li>
                }
                @if (CheckExt.AuthView(ViewBag.sr, "menu_extend"))
                {
                    <li class="layui-nav-item" title="扩展功能"><a href="javascript:;" onclick="loadMenu('/Admin/Menu/Extend')"><i class="layui-icon layui-icon-component" style="font-size: 22px;"></i></a></li>
                }
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-username" style="padding-left:10px; font-size: 30px; color: #1E9FFF;"></i>
                        @ViewBag.userInfo.Username
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="/" target="_blank"><i class="layui-icon layui-icon-website cxuu-list-ico"></i> 前台首页</a></dd>
                        <dd><a href="javascript:;" onclick="loadMain('/Admin/Home/Home')"><i class="layui-icon layui-icon-home cxuu-list-ico"></i> 后台主页</a></dd>
                                @if (CheckExt.AuthView(ViewBag.sr, "user_password"))
                                {
                           <dd><a href="javascript:;" onclick="loadMain('/Admin/User/PassWord')"><i class="layui-icon layui-icon-edit  cxuu-list-ico"></i> 修改密码</a></dd>
                                }
                       <dd> <a asp-area="Admin" asp-controller="Login" asp-action="LoginOut"> <i class="layui-icon layui-icon-export  cxuu-list-ico"></i> 退出登录</a></dd>
                </dl>
                </li>
                @if (CheckExt.AuthView(ViewBag.sr, "notice_index"))
                {
                    <li class="layui-nav-item" title="通知或站内信" lay-header-event="menuRight" lay-unselect>
                        <a href="javascript:;">
                            <i class="layui-icon layui-icon-email">
                                @if (ViewBag.noticeNum > 0)
                                {
                                    <span class="layui-badge">
                                        @ViewBag.noticeNum
                                    </span>
                                }
                            </i>
                        </a>
                    </li>
                }
            </ul>
        </div>
        <!-- 左侧导航 -->
        <div class="layui-side layui-bg-black cxuu-menu-left ">
            <div class="layui-side-scroll" id="leftMenu">
            </div>
        </div>
        <!-- 内容主体区域 -->
        <div class="layui-body">
            <div id="main" style="padding: 5px;"></div>
        </div>
        <!-- 底部固定区域 -->
        <div class="layui-footer">
            © cxuu.top - 龙啸轩管理后台
        </div>
    </div>
    <script src="~/lib/jquery.min.js"></script>
    <script src="~/lib/layui/layui.js"></script>
    <script>
        layui.use(['element', 'layer', 'jquery'], function () {
            var element = layui.element, layer = layui.layer, $ = layui.jquery,util = layui.util;
              util.event('lay-header-event', {
                menuRight: function(){
                  layer.open({
                    type: 2
                    ,title: '通知'
                    ,content: "/Admin/Notice/Index?readList=1"
                    ,area: ['260px', '100%']
                    ,offset: 'rt' //右上角
                    ,anim: 5
                    ,shadeClose: true
                    ,scrollbar: false
                    ,move: false
                  });
                }
              });
        });
        $("#main").load('/Admin/Home/Home');
        $("#leftMenu").load('/Admin/Menu/Index');
        function loadMain(url) {
            $("#main").load(url);
        }

        //左侧菜单控制
        var isShow = true;
        //初始化后台时，隐藏左栏
        //if (isShow) {
        //    leftMenuHide();
        //};
        function loadMenu(url) {
            $("#leftMenu").load(url);
            if (!isShow) {
                leftMenuShow();
            }
        }

        //左侧菜单隐藏控制
        $('#leftMenuCtrl i').addClass('layui-icon-shrink-right');
        $('#leftMenuCtrl').click(function () {
            if (isShow) {
                leftMenuHide();
            } else {
                leftMenuShow();
            }
        });
        function leftMenuHide() {
            $('.layui-side.layui-bg-black').width(0); //设置宽度
            $('#leftMenuCtrl i').toggleClass('layui-icon-spread-left');
            $(".layui-layout-admin").toggleClass("showMenu");
            $('#leftContent').hide();
            isShow = false;
        }
        function leftMenuShow() {
            $('.layui-side.layui-bg-black').width(200);
            $('#leftMenuCtrl i').toggleClass('layui-icon-spread-left');
            $(".layui-layout-admin").toggleClass("showMenu");
            $('#leftContent').show();
            isShow = true;
        }

        //防止页面后退
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', function () {
            history.pushState(null, null, document.URL);
        });
    </script>
</body>
</html>

